package com.example.springboot.controller;


import com.example.springboot.base.Result;
import com.example.springboot.service.FolderFileInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/folder")
public class FolderFileInfoController {

    @Autowired
    private FolderFileInfoService folderFileInfoService;

    @PostMapping("/getContent")
    public Result getFolderContent(@RequestParam("folderId") String folderId){
        return folderFileInfoService.getFolderContent(folderId);
    }

    @PostMapping("/createFolder")
    public Result createFolder(
            @RequestParam("folderId") String folderId,
            @RequestParam("folderName") String folderName
    ){
        return folderFileInfoService.createFolder(folderId,folderName);

    }

    @PostMapping("/deleteFolder")
    public Result deleteFolder(
            @RequestParam("folderId") String folderId
    ){
        return folderFileInfoService.deleteFolder(folderId);

    }

}

